import request from '@/router/axios'
import moment from 'moment';
export function getXw_tvm_shouJieSuan_waitSubmit(query) {
  let longSearch = query.longSearch;
  if(longSearch==1){
    query.endSettleDate = moment(query.endSettleDate).add(1,'days').format("YYYY-MM-DD")+" 01:59:59";
    //query.endTime = query.endSettleDate;
  }
  return request({
    url: '/check/xw_js_tvm/getXw_tvm_shouJieSuan_waitSubmit',
    method: 'post',
    params: query
  })
}


export function getXw_tvm_shouJieSuan_reportError_waitSubmit(query) {
  return request({
    url: '/check/xw_js_tvm/getXw_tvm_shouJieSuan_reportError_waitSubmit',
    method: 'post',
    params: query
  })
}
/**
 * 提交TVM结算SW_ST_TVM_INCOME_SETTLE
 * @param query
 */
export function submit_Xw_tvm_data(query) {
  return request({
    url: '/check/xw_js_tvm/submit_Xw_tvm_data',
    method: 'post',
    // params: query
    data:query
  })
}

//查看是否有待确认数据
export function getTvmNotConfirmDatas(query) {
  return request({
    url: '/check/xw_js_tvm/getTvmNotConfirmDatas',
    method: 'post',
    params: query,
    data:query
  })
}

/**
 * 报表差错提交TVM结算SW_ST_TVM_INCOME_SETTLE
 * @param query
 */
export function submit_Xw_tvm_reportError_data(query) {
  return request({
    url: '/check/xw_js_tvm/submit_Xw_tvm_reportError_data',
    method: 'post',
    // params: query
    data:query
  })
}

/**
 * 获取结算日期
 * @param query
 */
export function get_sw_ck_data_submit_date(query) {
  return request({
    url: '/check/xw_js_tvm/get_sw_ck_data_submit_date',
    method: 'post',
    params: query
  })
}

export function waitSubmitMainOptionList(th){
  return {
    emptyBtn:false,
    editBtn:false,
    rowKey:'index',
    delBtn:false,
    addBtn:false,
    refreshBtn:false,
    columnBtn:false,
    border: true,
    index:true,
    indexLabel:'序号',
    page:false,
    align:'center',
    menuWidth:150,
    menuAlign:'center',
    selection: true,
    reserveSelection:false,
    height: 450,
    column:[
      {prop:"tvmCode", label:"TVM编号",search:true},
      {prop:"preSubmitDate", label:"上次结算日期",type:'date',valueFormat:'yyyy-MM-dd',formatter:function (row,v) {
          if(!v){
            if(row.startTime){
              return moment(row.startTime).subtract(1,'days').format('YYYY-MM-DD');
            }else{
              return '';
            }

          }else{
            return row.log_endSettleDate;
          }
        }},
      {prop:"revenueTime", label:"收入日期",search:true,type:'date',valueFormat:'yyyy-MM-dd'},
      {prop:"lastSubmitTime",hide:true, label:"最晚提交日期",formatter:function(row,v){
        if(row.settlementTerm>=0){
            return moment(row.check_submit_end_date).subtract(1,"days").format('YYYY-MM-DD');
        }else{
            return row.revenueTime;
        }
      }},
      {prop:"cashReceiptAmount", hide:true, label:"现金实收金额",formatter:function (row,v) {
          if(v){
             return Number(v).toFixed(2);
          }
          return v;
        }},
        {prop:"checkAmount", label:"清点金额",formatter:function (row,v) {
          if(v){
             return Number(v).toFixed(2);
          }
          return v;
        }},
      {prop:"dailyCashTotalAmount", hide:true, label:"结账单据现金收入金额",formatter:function (row,v) {
          if(v){
             return Number(v).toFixed(2);
          }
          return v;
        }},
      {prop:"billCashCashReceiptAmount", hide:true,label:"结账单据现金接收总计",formatter:function (row,v) {
          if(v){
            return Number(v).toFixed(2);
          }
          return v;
        }},
      {prop:"billCashCashChangeAmount", hide:true,label:"结账单据现金找零总计",formatter:function (row,v) {
          if(v){
             return Number(v).toFixed(2);
          }
          return v;
        }},
      {prop:"electronicPayTotalAmount", hide:true,label:"结账单据电子收入金额",formatter:function (row,v) {
          if(v){
             return Number(v).toFixed(2);
          }
          return v;
        }},

    ]
  }
}





export function reportWaitSubmitMainOptionList(th){
  return {
    emptyBtn:false,
    editBtn:false,
    delBtn:false,
    addBtn:false,
    refreshBtn:false,
    columnBtn:false,
    border: true,
    index:true,
    indexLabel:'序号',
    page:false,
    align:'center',
    menuWidth:150,
    menuAlign:'center',
    selection: true,
    reserveSelection:false,
    height: 450,
    column:[
      {prop:"tvmCode", label:"TVM编号",search:true},
      {prop:"preSubmitDate", label:"上次结算日期",type:'date',valueFormat:'yyyy-MM-dd',formatter:function (row,v) {
          if(!v){
            if(row.startTime){
              return moment(row.startTime).subtract(1,'days').format('YYYY-MM-DD');
            }else{
              return '';
            }

          }else{
            return row.endSettleDate;
          }
        }},
      {prop:"revenueTime", label:"收入日期",type:'date',search:true,searchslot:true,valueFormat:'yyyy-MM-dd'},
      {prop:"lastSubmitTime", label:"最晚提交日期",formatter:function(row,v){
          if(row.settlementTerm>=0){
            return moment(row.revenueTime).add(row.settlementTerm, 'days').format('YYYY-MM-DD');
          }else{
            return row.revenueTime;
          }
        }},
      {prop:"cashReceiptAmount", hide:true,label:"现金实收金额",formatter:function (row,v) {
          if(v){
            return Number(v).toFixed(2);
          }
          return v;
        }},
        {prop:"checkAmount", label:"清点金额",formatter:function (row,v) {
          if(v){
             return Number(v).toFixed(2);
          }
          return v;
        }},
      {prop:"dailyCashTotalAmount", hide:true,label:"结账单据现金收入金额",formatter:function (row,v) {
          if(v){
            return Number(v).toFixed(2);
          }
          return v;
        }},
      {prop:"billCashCashReceiptAmount", hide:true,label:"结账单据现金接收总计",formatter:function (row,v) {
          if(v){
            return Number(v).toFixed(2);
          }
          return v;
        }},
      {prop:"billCashCashChangeAmount", hide:true,label:"结账单据现金找零总计",formatter:function (row,v) {
          if(v){
            return Number(v).toFixed(2);
          }
          return v;
        }},
      {prop:"electronicPayTotalAmount", hide:true,label:"结账单据电子收入金额",formatter:function (row,v) {
          if(v){
            return Number(v).toFixed(2);
          }
          return v;
        }},

    ]
  }
}
